package com.mystyle.le.qjnewsproject.fragment;


import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.ListView;

import com.mystyle.le.qjnewsproject.R;
import com.mystyle.le.qjnewsproject.adapter.TitleViewPagerAdapter;
import com.mystyle.le.qjnewsproject.adapter.TopPicAdapter;
import com.mystyle.le.qjnewsproject.beans.TopAd;

import java.util.ArrayList;
import java.util.List;

/**
 * A simple {@link Fragment} subclass.
 */
public class News_Est_Fragment extends Fragment {


    private ViewPager viewPager;
    private ListView listView;
    private List<ImageView> list = new ArrayList<>();
    private List<TopAd> topAds ;

    public News_Est_Fragment() {
        // Required empty public constructor
    }


    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        View view = inflater.inflate(R.layout.fragment_news__est_, container, false);
        initView(view);
        return view;
    }

    private void initView(View view) {
        viewPager = ((ViewPager) view.findViewById(R.id.title_Vp));
        listView = ((ListView) view.findViewById(R.id.title_lv));
        topAds = new ArrayList<>();
        TopPicAdapter picAdapter = new TopPicAdapter(list,getActivity(),topAds);

        TitleViewPagerAdapter adapter = new TitleViewPagerAdapter(list);
        viewPager.setAdapter(adapter);
    }

}
